home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
apl
/
gv_sh10.lzh
/
gv_sh.c
next >
Wrap
C/C++ Source or Header
|
1995-02-21
|
4KB
|
188 lines
/*
Copyright 1995 Ogasawara Hiroyuki(COR.)
*/
#include <corlib.h>
#include <sys_doslib.h>
#include "Sesse.inc"
#define PROG "GV_Sh v1.00"
#define GVIEWWIN "gview.win"
#define XSIZE (80-6)
#define YSIZE (42-12)
int WindowHeapSize= 1024*0;
static void
Error( msg )
char *msg;
{
ConsoleOpen();
ConsolePrint( msg );
ConsolePrint( "\r\n" );
}
static void
WaitMark()
{
MouseSetPattern( 1, &SessePattern, 7, 3 );
MS_SEL( 1 );
}
static void
MakeNewGWin( ng )
UGraphic *ng;
{
EventInfo info;
info.option= EventUser;
info.ComBuffer= ng;
info.ComData= UserGraphic;
PidSendEvent( GVIEWWIN, &info, TRUE );
MFREE( ng->buf );
}
#if 0
GV_Rot( gp )
UGraphic *gp;
{
UGraphic ng;
WaitMark();
if( gp->color == WindowAttrGraphic65536 ){
unsigned short *str= MALLOC( gp->h*gp->v*2 ),
*ptr= gp->buf;
int x, y;
if( (int)(ng.buf= str) < 0 )
return FALSE;
for( y= 0 ; y< gp->h ; y++ ){
for( x= gp->v-1 ; x >= 0 ; x-- )
*str++= ptr[x*gp->h +y];
}
}else{
unsigned char *str= MALLOC( gp->h*gp->v ),
*ptr= (void*)gp->buf;
int x, y;
if( (int)(ng.buf= (void*)str) < 0 )
return FALSE;
for( y= 0 ; y< gp->h ; y++ ){
for( x= gp->v-1 ; x >= 0 ; x-- )
*str++= ptr[x*gp->h +y];
}
}
ng.h= gp->v;
ng.v= gp->h;
MakeNewGWin( &ng, gp );
MS_SEL( 0 );
return TRUE;
}
#endif
GV_ToUG( sp )
Sheet *sp;
{
UGraphic ng;
unsigned char *str= MALLOC( sp->h*sp->v );
unsigned short *ptr1= (void*)sp->buf1, *ptr2= (void*)sp->buf2;
int x, y;
WaitMark();
if( (int)(ng.buf= (void*)str) < 0 ){
Error( "メモリが足りません" );
return FALSE;
}
for( y= 0 ; y< sp->v ; y++ ){
for( x= 0 ; x < sp->hword ; x++ ){
unsigned short a= *ptr1++,
b= *ptr2++;
int i, t= (x<<4)-sp->h, cc= t< 0 ? 16 : t;
for( i= 0 ; i< cc ; i++ ){
unsigned short c= 0;
/* 0, 14, 1, 15 */
if( (short)a < 0 )
c= 14;
if( (short)b < 0 )
c++;
*str++= c;
a+= a;
b+= b;
}
}
}
ng.h= sp->h;
ng.v= sp->v;
ng.color= WindowAttrGraphic16;
ng.palet= NULL;
MakeNewGWin( &ng );
MS_SEL( 0 );
return TRUE;
}
static int
EventExec( wp, info )
WindowID wp;
EventInfo *info;
{
DrawBuf dbuf[4];
switch( info->option ){
case EventOpen:
WindowSetEventAttr( wp, EventOpenON|EventRedrawON
|EventCloseON|EventMouseSwitchON|EventIconifyON
|EventUserON );
WindowRedraw( wp );
return TRUE;
case EventIconify:
IconEnt( wp, PROG, AttrDefault, 12 );
return TRUE;
case EventRedraw:
DrawSetClear( dbuf, ColorGray );
DrawSetSymbol( dbuf+1, 3, 1, PROG, 9|4, 12 );
DrawSetSymbol( dbuf+2, 3,14, "[Sheet=>UG]", 9, 12 );
WindowDraw( wp, dbuf, 3 );
return TRUE;
case EventClose:
WindowClose( wp );
WindowConnectionClose();
return TRUE;
case EventUser:
switch( info->ComData ){
case UserGraphic:
/*GV_ToSheet( info->ComBuffer );*/
return TRUE;
case UserSheet:
GV_ToUG( info->ComBuffer );
return TRUE;
case UserString:
case UserPaste:
case UserStrings:
break;
}
return FALSE;
case EventMouseSwitch:
if( info->LeftON ){
ConsoleOpen();
ConsolePrint(
"\r\n" PROG " 1995 COR.\r\n"
"-------------------------------------------------------------------------\r\n"
"16色UserGraphic<=Sheet変換を行います。変換したデータは gview へ転送します\r\n"
"-------------------------------------------------------------------------\r\n"
);
return TRUE;
}
return FALSE;
}
return FALSE;
}
void
WindowMain( argc, argv )
char **argv;
{
int x= 400, y= 0;
argc= AnalyzeArgs( argc, argv, &x, &y, NULL, NULL );
WindowTitleOpen( x, y, XSIZE, YSIZE, NULL, " ",
Close|Push|Icon, EventExec );
}